Fix coding-related core dumps with gcc -ftrapv.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 May 2012 22:27:21 +0000 (15:27 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 May 2012 22:27:21 +0000 (15:27 -0700)
commit45131d26defaa4cef06bd7f2daf614b9563560fc
tree70cfb2d6523f92231e98192283905f0f51ac528e
parent915e32a703a3274a07c576fb1198ef8c18d47443
Fix coding-related core dumps with gcc -ftrapv.

The code was computing A - B, where A and B are pointers, and B is
random garbage.  This can lead to core dumps on platforms that
have special pointer registers, and it also leads to core dumps on
x86-64 when compiled with gcc -ftrapv.  The fix is to compute
A - B only when B is initialized properly.
* coding.c (coding_set_source, coding_set_destination): Return void.
(coding_change_source, coding_change_destinations): New functions,
with the old behaviors of coding_set_source and coding_set_destination.
All callers that need an offset changed to use these new functions.
src/ChangeLog
src/coding.c